<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/29
 * Time: 16:36
 */
require "includes/OrderClass.php";

//判断AJax请求
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')) {
    $object = new OrderClass();
    $obj = $object->FindById($_REQUEST['id']);

}
?>
<style>
    #pay-result {
        width: 310px;
        margin: auto;
    }

    .pay-header {
        text-align: center;
        padding: 0 55px;
        margin: 10px 0;
    }

    .pay-header img {
        width: 88px;
        height: 88px;
    }

    .pay-header .title {
        font-size: 22px;
        font-weight: bold;
        color: #333;
    }

    .pay-order {
        padding: 15px 25px;
        background-color: #2FCD38;
        min-height: 210px;
        color: #fff;
    }

    .pay-order p {
        padding: 5px 0;
    }

    .pay-order .btn {
        padding-top: 20px;
        width: 100%;
    }

    .pay-order .btn a {
        display: block;
        width: 100%;
        background-color: #fff;
        height: 35px;
        color: #333;
        border-radius: 3px;
        text-align: center;
        line-height: 35px;
    }

    .pay-order .btn a:hover {
        background-color: #f1f1f1;
    }
</style>
<div id="pay-result">
    <div class="pay-header">
        <img src="/static/img/wechat-pay-success.svg">
        <p class="title">支付成功</p>
    </div>
    <div class="pay-order">
        <p>订单编号：<?=$obj->order_sn?></p>
        <p>购买商品：<?=$obj->order_title?></p>
        <p>支付金额：<?=$obj->amount?>元</p>
        <p>交易时间：<?=$obj->create_time?></p>
        <p class="btn">
            <a href="javascript:;">返 回</a>
        </p>
    </div>
</div>
<script>
    $('#pay-content').css('padding', '0');

    function refresh() {
        if ($('#pay-content').length > 0) {
            clearInterval(window.pay_times);
            window.pay_times = null;
            // window.top.location.href = '/index.php';
        }
    }

    if (!window.pay_times)
        window.pay_times = setInterval('refresh()', 200);
</script>

